/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.playground.core.repository;

import com.playground.core.entity.Invitation;
import com.playground.core.entity.Player;
import java.util.List;

/**
 *
 * @author Tiago Peres
 */
public interface InvitationRepository {
    /**
     * Save the invitation, creates a new one if it doesn't exist.
     * 
     * @param invitation the invitation to be saved
     * @return the recently saved invitation
     */
    Invitation save(Invitation invitation);
    
    /**
     * Retrieves the invitation made by the given player, if there is such
     * invitation.
     * 
     * @param player the invitation's host
     * @return the invitation having "player" as host, null if there's no such
     * invitation
     */
    Invitation getInvitationByHost(Player player);
    
    /**
     * @return all the invitations in the system
     */
    List<Invitation> findAll();
    
    /**
     * Removes the specified invitation.
     * 
     * @param invitation the invitation to be removed
     */
    void delete(Invitation invitation);
    
    /**
     * Removes all Invitations
     */
    void deleteAll();
}
